<?php
namespace App\Http\Controllers\Backend\Member;

use App\Http\Controllers\Backend\BaseController;
use App\Http\Requests\Backend\Member\IndexRequest;
use App\Repositories\PrtMemberRepository;

/**
 * 项目说明
 * 详细说明
 * @author:
 * @version: 1.0
 * @date:
 */
class IndexController extends BaseController
{
    protected $viewPath = 'backend.member.index';  //当前控制器所的view所在的目录
    protected $modules = 'sys';        //当前控制器所属模块
    protected $codePrefix = '';        //编码前缀
    public function __construct(PrtMemberRepository $Repository)
    {
        parent::__construct();
        $this->repositories = $Repository;
        view()->share("lv_id_list",config("common.member_lv") ?? []);
view()->share("status_list",config("status.open_close") ?? []);

    }

   //添加/编辑操作
    public function save(IndexRequest $request)
    {
        $params = $request->all();
        $params['birthday'] = strtotime($params['birthday']);

        $ret = $this->repositories->save($params);
        if ($ret) {
            return $this->jsonSuccess([]);
        } else {
            return $this->jsonFailed('');
        }
    }

}
